
#include "DefenderRole.h"
#include "../Ship.h"
#include "../Player.h"
#include "../GameState.h"
#include "../Team.h"
#include "../World.h"
#include "../Map.h"


DefenderRole::DefenderRole(Ship *my_ship) :
    my_ship(my_ship) {

    my_team_id = my_ship->getControllingPlayer()->getTeamId();

    Vector2D focus =  GameState::instance().getTeam(my_team_id).getFlag()->getPosition();
    float max_dist = World::instance().getMap()->getWidth()/3.0f;
    loiter = new LoiterBehaviour(my_ship, focus, max_dist);
}

DefenderRole::~DefenderRole(){
    delete loiter;
}

bool DefenderRole::shouldIBeDefender(void){
    return false;
}

bool DefenderRole::perform(void){
    loiter->perform();
    return true;
}

